package com.tuanbiao.ui.blast;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.hzjq.lib.cap.bean.ErrorCap;
import com.tuanbiao.R;

/**
 * @author abiao
 * @since 2022/4/26 17:19
 */
public class BlastCheckErrorAdapter extends BaseQuickAdapter<ErrorCap, BaseViewHolder> {
    public BlastCheckErrorAdapter() {
        super(R.layout.item_blast_check_error);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, ErrorCap errorCap) {
        holder.setText(R.id.tv_location, getContext().getString(R.string.detonator_register_adapter_location, errorCap.getRow(), errorCap.getHole()))
                .setText(R.id.tv_code, errorCap.getCap().getCap().getConvertUid())
                .setText(R.id.tv_delay, getContext().getString(R.string.detonator_register_adapter_init_delay, errorCap.getCap().getCap().getDelay()))
                .setText(R.id.tv_status, errorCap.getCap().getError());
    }

    private String getErrorMsg(int errorCode) {
        if (errorCode == 12) {
            return "充电失败";
        } else if (errorCode == 9) {
            return "校时失败";
        } else if (errorCode == 7) {
            return "授权失败";
        } else if (errorCode == 2) {
            return "漏接";
        } else if (errorCode == 1) {
            return "多接";
        } else {
            return "";
        }
    }
}
